/*
 *Program Name: LittleGuy.cpp
 *Written By:   Cheng-Hsiu Hsieh
 */

#include "LittleGuy.h"
#include "SharedConstants.h"
#include "corona/corona.h"
#include <GL/glut.h>
#include <math.h>

//-----------------------------------------------------------------------------
// Globals:
//-----------------------------------------------------------------------------
cLittleGuy gLittleGuy;
static float BULLET_SPEED = -0.001f;

//-----------------------------------------------------------------------------
// Functions:
//-----------------------------------------------------------------------------
cLittleGuy* GetLittleGuy()
{
  return &gLittleGuy;
}

cLittleGuy::cLittleGuy():cJet( 100 , 0 , 100)
{
}

cLittleGuy::~cLittleGuy()
{
}

int cLittleGuy::die()
{
  ////////////////
  //Dying effect//
  ////////////////

  return getScore();
  //return the score to the one who kills it
}

void cLittleGuy::Draw()
{
	// push a matrix and translate for this model's position.
	glMatrixMode(GL_MODELVIEW);

  glPushMatrix();
  glTranslatef( getXPosition(),
                getYPosition(),
                getZPosition() );
  
  glRotatef( -90.0f, 0.0f, 1.0f, 0.0f );
  this->Frame(1.0f, 0.2f, 0.2f);  

  glPopMatrix();
}

void cLittleGuy::shoot()
{
  this->fire( BULLET_SPEED );
}

void cLittleGuy::reset( float x , float y )
{
  this->setHide( false );
  setXPosition( x );
  setYPosition( y );
  setZPosition( kStart );
}